import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';

/**
 * 用户价格策略信息
 */
@Entity('goods_user_price_strategy')
export class GoodsUserPriceStrategyEntity extends BaseEntity {
  @Index()
  @Column({ comment: '用户ID' })
  userId: number;

  @Column({
    comment: '策略类型',
    dict: ['普通用户', 'VIP用户', '批发用户', '合作伙伴', '区域代理'],
    default: 0,
  })
  strategyType: number;

  @Column({
    comment: '折扣比例(百分比)',
    type: 'decimal',
    precision: 5,
    scale: 2,
    default: 100,
  })
  discountRate: number;

  @Column({
    comment: '最低折扣限制',
    type: 'decimal',
    precision: 5,
    scale: 2,
    nullable: true,
  })
  minDiscountRate: number;

  @Column({ comment: '生效时间', nullable: true })
  startTime: Date;

  @Column({ comment: '失效时间', nullable: true })
  endTime: Date;

  @Column({ comment: '状态', dict: ['禁用', '启用'], default: 1 })
  status: number;

  @Column({ comment: '备注', nullable: true })
  remark: string;
}
